package com.yuw.collectionsdemo;

import java.util.Comparator;

public class MonitorComparator implements Comparator<Monitor> {
    @Override
    public int compare(Monitor o1, Monitor o2) {
        // 默认返回值
        int iVal = 0;
        if (o1 != null && o2 != null) {
            // 比较o1和o2的大小
            if (o1.getStuScore() > o2.getStuScore()) {
                iVal = 1;
            } else if (o1.getStuScore() < o2.getStuScore()) {
                iVal = -1;
            }
        }
        return iVal*-1;
    }
}
